package com.sprite.email.entity;

import lombok.Data;

import java.io.Serializable;
import java.util.Map;

@Data public class Mail implements Serializable {

    private static final long serialVersionUID = 1L;

    /** 邮件标题 */
    private String              title;
    /** 邮件内容 */
    private String              content;
    /** 收件地址 */
    private String              to;
    /** 模板名称 */
    private String              templateName;
    /** 模板变量替换 */
    private Map<String, Object> maps;

    public Mail() {
        throw new RuntimeException("");
    }

    private Mail(Builder builder) {
        title = builder.title;
        content = builder.content;
        to = builder.to;
        templateName = builder.templateName;
        maps = builder.maps;
    }

    public static final class Builder {
        private String              title;
        private String              content;
        private String              to;
        private String              templateName;
        private Map<String, Object> maps;

        public Builder() {
        }

        public Builder title(String val) {
            title = val;
            return this;
        }

        public Builder content(String val) {
            content = val;
            return this;
        }

        public Builder to(String val) {
            to = val;
            return this;
        }

        public Builder templateName(String val) {
            templateName = val;
            return this;
        }

        public Builder maps(Map<String, Object> val) {
            maps = val;
            return this;
        }

        public Mail build() {
            return new Mail(this);
        }
    }
}
